#include <iostream>
#include <any>
#include <string>

#include <antlr4-runtime.h>
#include <plc2llvm/Lexer/PLCSTLexer.h>
#include <plc2llvm/Parser/PLCSTParser.h>
#include <plc2llvm/Visitor/Visitor.h>
#include <plc2llvm/utils/Log.h>


using namespace antlr4;
// using namespace std;

int main(int argc, char** argv)
{
	std::ifstream stream;
	stream.open(argv[1]);
	ANTLRInputStream input(stream);
	plcst::PLCSTLexer lexer(&input);
	CommonTokenStream tokens(&lexer);
	plcst::PLCSTParser parser(&tokens);

	tree::ParseTree *tree = parser.startpoint();
    int i = 1;
    Debug << "开始遍历";
    Visitor visitor;

	visitor.visit(tree);
    std::cout << tree->toStringTree() << std::endl;
    Info << "结束遍历";
	return 0;

}